package com.squirrel.serialportcore.machine.init;

import com.squirrel.serialportcore.common.CommonBase;
import com.squirrel.serialportcore.machine.init.before.CommPortInitializer;
import com.squirrel.serialportcore.machine.init.before.JsonReader;
import com.squirrel.serialportcore.machine.init.before.NameInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Spring初始化之前的全局初始器
 *
 * @author Squbi
 * @date 2021/3/23 11:28
 */
public class BeforeGlobalInitializer {
    private static final Logger logger = LoggerFactory.getLogger(BeforeGlobalInitializer.class);

    private BeforeGlobalInitializer() {
    }

    public static void run() {
        logger.info(" --- 开始全局初始化程序 ---");
        CommonBase.getStopWatch().start();
        logger.info(" --- 开始读取配置文件 ---");
        JsonReader.read();
        logger.info(" --- 开始初始化读取端口 ---");
        CommPortInitializer.initIdentifier();
        logger.info(" --- 开始初始配置名称 ---");
        NameInitializer.initName();
    }
}
